import pandas as pd
df_all=pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省家庭总户数数据.csv',skiprows=3,encoding="gbk")
df_all=df_all.iloc[:-2]
df_1  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省一户家庭数据.csv', skiprows=3,encoding="gbk")
df_1=df_1.iloc[:-2]
df_2  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省两户家庭数据.csv', skiprows=3,encoding="gbk")
df_2=df_2.iloc[:-2]
df_3  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省三户家庭数据.csv', skiprows=3,encoding="gbk")
df_3=df_3.iloc[:-2]
df_4  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省四户家庭数据.csv', skiprows=3,encoding="gbk")
df_4=df_4.iloc[:-2]
df_5  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省五户年度数据.csv', skiprows=3,encoding="gbk")
df_5=df_5.iloc[:-2]
df_6  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省六户年度数据.csv', skiprows=3,encoding="gbk")
df_6=df_6.iloc[:-2]
df_7  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省七户年度数据.csv', skiprows=3,encoding="gbk")
df_7=df_7.iloc[:-2]
df_8  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省八户年度数据.csv', skiprows=3,encoding="gbk")
df_8=df_8.iloc[:-2]
df_9  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省九户年度数据.csv', skiprows=3,encoding="gbk")
df_9=df_9.iloc[:-2]
df_10  =pd.read_csv(r'D:\py\pythonProject\population-data\data\originalData\分省十户及以上年度数据.csv', skiprows=3,encoding="gbk")
df_10=df_10.iloc[:-2]

"""
df_1.iloc[:,1:] = df_1.iloc[:,1:]/df_all.iloc[:,1:]
df_1.iloc[:, 1:] = df_1.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
print(df_1.iloc[:,1:])
df_1.to_csv(r"D:\py\pythonProject\population-data\data\temp\一户家庭结构.csv",encoding="gbk")
df_2.iloc[:,1:] = df_2.iloc[:,1:]/df_all.iloc[:,1:]
df_2.iloc[:, 1:] = df_2.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
df_2.to_csv(r"D:\py\pythonProject\population-data\data\temp\两户家庭结构.csv",encoding="gbk")
df_3.iloc[:,1:] = df_3.iloc[:,1:]/df_all.iloc[:,1:]
df_3.iloc[:, 1:] = df_3.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
df_3.to_csv(r"D:\py\pythonProject\population-data\data\temp\三户家庭结构.csv",encoding="gbk")
"""

df_4.iloc[:,1:] = df_4.iloc[:,1:]/df_all.iloc[:,1:]
df_4.iloc[:, 1:] = df_4.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
df_4.to_csv(r"D:\py\pythonProject\population-data\data\temp\四户家庭结构.csv",encoding="gbk")
df_5.iloc[:,1:] = df_5.iloc[:,1:]/df_all.iloc[:,1:]
df_5.iloc[:, 1:] = df_5.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
df_5.to_csv(r"D:\py\pythonProject\population-data\data\temp\五户家庭结构.csv",encoding="gbk")
df_6.iloc[:,1:] = df_6.iloc[:,1:]/df_all.iloc[:,1:]
df_6.iloc[:, 1:] = df_6.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
df_6.to_csv(r"D:\py\pythonProject\population-data\data\temp\六户家庭结构.csv",encoding="gbk")
df_7.iloc[:,1:] = df_7.iloc[:,1:]/df_all.iloc[:,1:]
df_7.iloc[:, 1:] = df_7.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
df_7.to_csv(r"D:\py\pythonProject\population-data\data\temp\七户家庭结构.csv",encoding="gbk")
df_8.iloc[:,1:] = df_8.iloc[:,1:]/df_all.iloc[:,1:]
df_8.iloc[:, 1:] = df_8.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
df_8.to_csv(r"D:\py\pythonProject\population-data\data\temp\八户家庭结构.csv",encoding="gbk")
df_9.iloc[:,1:] = df_9.iloc[:,1:]/df_all.iloc[:,1:]
df_9.iloc[:, 1:] = df_9.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
df_9.to_csv(r"D:\py\pythonProject\population-data\data\temp\九户家庭结构.csv",encoding="gbk")
df_10.iloc[:,1:] = df_10.iloc[:,1:]/df_all.iloc[:,1:]
df_10.iloc[:, 1:] = df_10.iloc[:, 1:].applymap(lambda x: round(x * 100, 2))
df_10.to_csv(r"D:\py\pythonProject\population-data\data\temp\十户及以上家庭结构.csv",encoding="gbk")